package ihc.terminalbanco.gui.panels;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;

public class SegurancaPane extends JPanel implements RotulosInterface {

    /**
     *
     */
    private static final long serialVersionUID = 2929713786372228855L;

    public SegurancaPane(ActionListener actionListener, Font font) {
        this.setLayout(new BorderLayout());

        Border raisedbevel = BorderFactory.createRaisedBevelBorder();
        /*
         * Panels
         */
        //CENTER

        JPanel painelCentralSuperior = new JPanel();
        painelCentralSuperior.setLayout(new FlowLayout(FlowLayout.CENTER));

        JLabel senhaAdicional = new JLabel("SENHA ADICIONAL");
        senhaAdicional.setFont(font);
        painelCentralSuperior.add(senhaAdicional);

        JPanel painelCentralPai = new JPanel();
        painelCentralPai.setLayout(new GridLayout(3, 1, 0, 30));

        JPanel painelCentralFilhoOpcoes = new JPanel();
        painelCentralFilhoOpcoes.setLayout(new GridLayout(2, 6, 10, 10));

        JLabel senhaA = new JLabel("A: 4");
        JLabel senhaB = new JLabel("B: 6");
        JLabel senhaC = new JLabel("C: 2");
        JLabel senhaD = new JLabel("D: 0");
        JLabel senhaE = new JLabel("E: 5");
        JLabel senhaF = new JLabel("F: 8");
        JLabel senhaG = new JLabel("G: 7");
        JLabel senhaH = new JLabel("H: 9");
        JLabel senhaI = new JLabel("I: 1");
        JLabel senhaJ = new JLabel("J: 3");
        JLabel vazio1 = new JLabel(" ");
        JLabel vazio2 = new JLabel(" ");

        painelCentralFilhoOpcoes.add(vazio1);
        painelCentralFilhoOpcoes.add(senhaA);
        painelCentralFilhoOpcoes.add(senhaB);
        painelCentralFilhoOpcoes.add(senhaC);
        painelCentralFilhoOpcoes.add(senhaD);
        painelCentralFilhoOpcoes.add(senhaE);
        painelCentralFilhoOpcoes.add(vazio2);
        painelCentralFilhoOpcoes.add(senhaF);
        painelCentralFilhoOpcoes.add(senhaG);
        painelCentralFilhoOpcoes.add(senhaH);
        painelCentralFilhoOpcoes.add(senhaI);
        painelCentralFilhoOpcoes.add(senhaJ);


        JPanel painelCentralFilhoNumero = new JPanel();
        painelCentralFilhoNumero.setLayout(new GridLayout(1, 2, 10, 100));


        painelCentralPai.add(painelCentralFilhoOpcoes);
        painelCentralPai.add(painelCentralFilhoNumero);

        JLabel numero = new JLabel("Número: ");
        JTextField entradaNumero = new JTextField();


        painelCentralFilhoNumero.add(numero);
        painelCentralFilhoNumero.add(entradaNumero);


        painelCentralFilhoNumero.setBorder(raisedbevel);

        //SOUTH
        JPanel painelSul = new JPanel();
        painelSul.setLayout(new GridLayout(1, 2, 100, 0));

        JButton sairButton = new JButton(anularString);
        sairButton.setFont(font);
        sairButton.setVisible(true);
        sairButton.addActionListener(actionListener);
        painelSul.add(sairButton);

        JButton confirmarButton = new JButton(confirmarString);
        confirmarButton.setFont(font);
        confirmarButton.setVisible(true);
        confirmarButton.addActionListener(actionListener);
        painelSul.add(confirmarButton);
        painelSul.setPreferredSize(new Dimension(480, 100));

        //Juntando
        JPanel painelCentralPrincipal = new JPanel();
        painelCentralPrincipal.setLayout(new GridLayout(2, 1));
        painelCentralPrincipal.add(painelCentralSuperior);
        painelCentralPrincipal.add(painelCentralPai);

        this.add(painelCentralPrincipal, BorderLayout.CENTER);
        this.add(painelSul, BorderLayout.SOUTH);

    }
}
